package cn.bellychang.deferredresult;

import cn.bellychang.annotation.HfiDataSource;
import cn.bellychang.db1.model.Synonym;
import cn.bellychang.db1.repository.SynonymRepository;
import cn.bellychang.db1.service.SynonymService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author ChangLiang
 * @date 2020/9/10
 */
@RestController
public class EsController {

    @Autowired
    private SynonymRepository repository;

    @Autowired
    private SynonymService service;

    @GetMapping("synonym-service")
    public List<Synonym> ListNohitSuggest() {
        return service.findAll();
    }

    @GetMapping("synonym")
    @HfiDataSource("queryDb")
    public List<Synonym>  ListSynonym() {
        List<Synonym> all = repository.findAll();
        return all;
    }
}
